﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QDT.Core.Deals;
using QDT.Core.Members;
using QDT.Core.Projects;

namespace QDT.Core.Deals
{
    /// <summary>
    /// 债务人的回款记录
    /// </summary>
    public class DebtorRepayment : Entity, IAggregeRoot
    {
        public DebtorRepayment() {
            ManageMoney = 0;
        }

        public DebtorRepayment(Project project,User user,decimal money,decimal selfmoney) {
            ProjectID = project.ID;
            UserID = user.ID;
            RepayMoney = money;
            SelfMoney = selfmoney;
        }

        /// <summary>
        /// 项目的ID
        /// </summary>
        public int ProjectID { get; set; }

        /// <summary>
        /// 还款期次
        /// </summary>
        public int Stage { get; set; }

        /// <summary>
        /// 还款人的ID
        /// </summary>
        public int UserID { get; set; }

        /// <summary>
        /// 偿还的本金部分
        /// </summary>
        public decimal SelfMoney { get; set; }

        /// <summary>
        /// 偿还的总金额
        /// </summary>
        public decimal RepayMoney { get; set; }

        /// <summary>
        /// 管理费
        /// </summary>
        public decimal ManageMoney { get; set; }

        /// <summary>
        /// 正常应该偿还的时间
        /// </summary>
        public DateTime RepayTime { get; set; }

        /// <summary>
        /// 真正偿还的时间
        /// </summary>
        public DateTime TrueRepayTime { get; set; }

        /// <summary>
        /// 本期还款的状态
        /// </summary>
        public RepayStatus Status
        {
            get
            {
                return (RepayStatus)InnerStatus;
            }
            set { InnerStatus = (int)value; }
        }

        public int InnerStatus { get; set; }

        /// <summary>
        /// 还款备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 是否偿还
        /// </summary>
        public bool HasReply { get; set; }
    }
}
